package com.ruoyi.business.service;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.bizsys.domain.*;
import com.ruoyi.business.domain.CustLoanIou;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author: cyh
 *
 */
public interface ILoanService {

    void rulePass(String loanSerialNo);

    void loanPayTrans(String applySerialNo);

    /**
     * 开始放款
     * @param loanOrder
     */
    void startLending(LoanOrder loanOrder);

    /**
     * 放款结果处理
     * @param loanOrder
     * @param isReTryTask 区分是否重试定时任务。定时任务调用时 若 放款流水号已存在则需要返回一个false。isReTryTask=false时逻辑不变
     * @return
     */
    boolean verifyTransfer(LoanOrder loanOrder, boolean isReTryTask);

    /**
     * 处理贷款结果，成功或失败
     * @return
     */
    void dealLoanResult(String loanSerialNo,String result);

    void dealSuccessLoan(LoanOrder loanOrder);

    void dealFailedLoan(LoanOrder loanOrder);

    String createContractPdf(LoanOrder loanOrder);

    /**
     * 延期购买成功创建子借据
     * @param minRepayAmt
     * @param loanIouForPdf
     * @param loanIouDeferred
     */
    void createDeferredContractPdf(BigDecimal minRepayAmt, LoanIou loanIouForPdf, LoanIouDeferred loanIouDeferred);

    /**
     * 解冻提现冻结金、更新提现状态
     * @param loanOrder
     * @param loanStatus
     * @param errMsg
     */
    void updateFrozenAndLoanStatus(LoanOrder loanOrder, Integer loanStatus, String errMsg);

    String againTrigger(LoanOrder loanOrder);

    void checkWalletWithdrawIouStatus();

    void checkIou(String custNo);
    /**
     * 财务点击调用业务系统进行放款
     * @param ids
     * @return
     */
    JSONObject callInitiateTransfer(String ids);
}
